package org.jeecg.modules.online.cgform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.lang.invoke.SerializedLambda;
import java.util.List;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.TuringBootException;
import org.jeecg.modules.online.cgform.entity.OnlCgformButton;
import org.jeecg.modules.online.cgform.mapper.OnlCgformButtonMapper;
import org.jeecg.modules.online.cgform.service.IOnlCgformButtonService;
import org.jeecg.modules.online.cgform.utils.BuiltInButtonUtils;
import org.springframework.stereotype.Service;

@Service("onlCgformButtonServiceImpl")
/* renamed from: org.jeecg.modules.online.cgform.service.a.a */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/service/a/a.class */
public class OnlCgformButtonServiceImpl extends ServiceImpl<OnlCgformButtonMapper, OnlCgformButton> implements IOnlCgformButtonService {
    /* renamed from: a */
//    private static /* synthetic */ Object m261a(SerializedLambda serializedLambda) {
//        String implMethodName = serializedLambda.getImplMethodName();
//        boolean z = true;
//        switch (implMethodName) {
//            case "getButtonCode":
//                if (implMethodName.equals("getButtonCode")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case "getId":
//                if (implMethodName.equals("getId")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case "getCgformHeadId":
//                if (implMethodName.equals("getCgformHeadId")) {
//                    z = false;
//                    break;
//                }
//                break;
//        }
//        switch (z) {
//            case false:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                		&& serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                		&& serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                		&& serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                		&& serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getId();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getButtonCode();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                		&& serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                		&& serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getButtonCode();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") 
//                		&& serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") 
//                		&& serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformButton") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getButtonCode();
//                    };
//                }
//                break;
//        }
//        throw new IllegalArgumentException("Invalid lambda deserialization");
//    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformButtonService
    public void saveButton(OnlCgformButton onlCgformButton) {
        Long selectCount = (this.baseMapper).selectCount( ( new LambdaQueryWrapper<OnlCgformButton>().eq(OnlCgformButton::getButtonCode, onlCgformButton.getButtonCode()))
        		.eq(OnlCgformButton::getCgformHeadId, onlCgformButton.getCgformHeadId()));
        if (selectCount == null || selectCount.longValue() == 0) {
            save(onlCgformButton);
            return;
        }
        throw new TuringBootException("按钮编码不能重复");
    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformButtonService
    public Result<OnlCgformButton> editButton(OnlCgformButton onlCgformButton) {
        Result<OnlCgformButton> result = new Result<>();
        if (((OnlCgformButton) getById(onlCgformButton.getId())) == null) {
            result.error500("未找到对应实体");
        } else {
            Long selectCount = this.baseMapper.selectCount( ( ( new LambdaQueryWrapper<OnlCgformButton>().eq(OnlCgformButton::getButtonCode, onlCgformButton.getButtonCode()))
            		.eq(OnlCgformButton::getCgformHeadId, onlCgformButton.getCgformHeadId())).ne(OnlCgformButton::getId, onlCgformButton.getId()));
            if (selectCount == null || selectCount.longValue() == 0) {
                if (updateById(onlCgformButton)) {
                    result.success("修改成功!");
                } else {
                    result.error500("修改失败!");
                }
            } else {
                result.error500("按钮编码不能重复");
            }
        }
        return result;
    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformButtonService
    public List<OnlCgformButton> queryBuiltInButtonList(String formId) {
        LambdaQueryWrapper<OnlCgformButton> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(OnlCgformButton::getCgformHeadId, formId);
        lambdaQueryWrapper.in(OnlCgformButton::getButtonCode, BuiltInButtonUtils.getButtonCodeSet());
        return BuiltInButtonUtils.m389a(formId, super.list(lambdaQueryWrapper));
    }
}
